package cn.edu.sgu.www.mhxysy.controller.baoshi;

import cn.edu.sgu.www.mhxysy.consts.CustomConstants;
import cn.edu.sgu.www.mhxysy.consts.CustomMessages;
import cn.edu.sgu.www.mhxysy.consts.MimeTypes;
import cn.edu.sgu.www.mhxysy.restful.JsonResult;
import cn.edu.sgu.www.mhxysy.service.baoshi.EquipmentBaoshiGradeService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Api(tags = "装备宝石等级管理")
@ApiSupport(author = CustomConstants.AUTHOR)
@Validated
@RestController
@RequestMapping(path = "/equipment_baoshi_grade", produces = MimeTypes.APPLICATION_JSON_CHARSET_UTF_8)
public class EquipmentBaoshiGradeController {

    private final EquipmentBaoshiGradeService equipmentBaoshiGradeService;

    @Autowired
    public EquipmentBaoshiGradeController(EquipmentBaoshiGradeService equipmentBaoshiGradeService) {
        this.equipmentBaoshiGradeService = equipmentBaoshiGradeService;
    }

    @ApiOperation("查询宝石可镶嵌的装备等级")
    @RequestMapping(value = "/selectEquipmentGrade", method = RequestMethod.GET)
    public JsonResult<Integer> selectEquipmentGrade(
            @ApiParam(name = "baoshiGrade", value = "宝石等级", required = true)
            @NotNull(message = "宝石等级" + CustomMessages.NOT_NULL) Integer baoshiGrade) {
        Integer grade = equipmentBaoshiGradeService.selectEquipmentGrade(baoshiGrade);

        return JsonResult.success(null, grade);
    }

}